<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
    <ui:composition >
        <a4j:loadScript src="/resources/js/com.js"/>
        <table width="100%">
            <tr>
                <td colspan="2"><h:outputText value="上传毕业证扫描图片" />
                    &nbsp;</td>
            </tr>
            <tr>
                <td valign="top" > <p>
                        <rich:fileUpload  id="upload"
                                          fileUploadListener="#{registerMbean.uploadListener}"
                                          addControlLabel="浏览" clearAllControlLabel="清除所有"
                                          doneLabel="已经加载"  clearControlLabel="清除"
                                          cancelEntryControlLabel="取消"
                                          stopControlLabel="停止"
                                          uploadControlLabel="加载"
                                          sizeErrorLabel="您加载的图片超过限制大小"
                                          transferErrorLabel="加载失败请稍后再试"
                                          onclear="getObj('regform:regsub:hiddenclear').click();"
                                          listHeight="100" listWidth="300"
                                          maxFilesQuantity="1"
                                          immediateUpload="false"
                                          acceptedTypes="jpg, gif, png, bmp">
                            <a4j:support event="onuploadcomplete" reRender="info" immediate="true"/>
                        </rich:fileUpload>
                        &nbsp;</p>
                </td>
                <td rowspan="2" valign="top">
                    <rich:panel id="info" style="height: 240;width:320;">
                        <f:facet name="header">
                            <h:outputText value="预览" />
                        </f:facet>
                        <h:outputText value="无图片"
                                      rendered="#{registerMbean.imgData.extension==null}" />
                        <a4j:mediaOutput element="img" mimeType="#{registerMbean.imgData.mime}"
                                         createContent="#{registerMbean.paint}" value="1"
                                         style="height:200px;width:300px;" cacheable="false"
                                         rendered="#{registerMbean.imgData.extension!=null}"/>
                    </rich:panel>&nbsp;
                </td>
            </tr>
            <tr>
                <td valign="bottom">
                    <a4j:commandButton  id="hiddenclear" style="display:none" action="#{registerMbean.clearAction}" reRender="upload,info" immediate="true" />
                    <a4j:commandButton style="float:center" action="#{registerMbean.registAction}" value="完成注册"/>            </td>
            </tr>
        </table>
    </ui:composition>
</html>